<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>Repetier-Firmware: src/ArduinoAVR/Repetier/HAL.cpp File Reference</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  <td id="projectlogo"><img alt="Logo" src="repetier-logo-trans128.png"/></td>
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">Repetier-Firmware
   &#160;<span id="projectnumber">0.91</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.6.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('_h_a_l_8cpp.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#define-members">Defines</a> &#124;
<a href="#func-members">Functions</a> &#124;
<a href="#var-members">Variables</a>  </div>
  <div class="headertitle">
<div class="title">src/ArduinoAVR/Repetier/HAL.cpp File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include &quot;<a class="el" href="_repetier_8h_source.html">Repetier.h</a>&quot;</code><br/>
<code>#include &lt;compat/twi.h&gt;</code><br/>
<code>#include &lt;avr/io.h&gt;</code><br/>
</div><table class="memberdecls">
<tr><td colspan="2"><h2><a name="define-members"></a>
Defines</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_h_a_l_8cpp.html#ad85813cb15982722984f0f0db49088f8">serialEvent_implemented</a></td></tr>
<tr><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_h_a_l_8cpp.html#a179289a2897d5034b844a3c4de1abc32">setTimer</a> (unsigned long delay)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the timer 1 compare value to delay ticks.  <a href="#a179289a2897d5034b844a3c4de1abc32"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_h_a_l_8cpp.html#ad39420cdd896dd12c68e36313139d0a5">ISR</a> (TIMER1_COMPA_vect)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Timer interrupt routine to drive the stepper motors.  <a href="#ad39420cdd896dd12c68e36313139d0a5"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_h_a_l_8cpp.html#a6aae7116e915b82806978c601e42ec42">ISR</a> (<a class="el" href="_h_a_l_8h.html#a0ad5f01af339a57de4bd2a3531300d18">PWM_TIMER_VECTOR</a>)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_h_a_l_8cpp.html#a66f94003221e0886abfe3f0ad6f73879">ISR</a> (<a class="el" href="_h_a_l_8h.html#a5493104832094f07b22a464e74bd27e5">EXTRUDER_TIMER_VECTOR</a>)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Timer routine for extruder stepper.  <a href="#a66f94003221e0886abfe3f0ad6f73879"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_h_a_l_8cpp.html#a26acc3d99d422c9739b7ab6c968772ca">rf_store_char</a> (unsigned char c, <a class="el" href="structring__buffer.html">ring_buffer</a> *buffer)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_h_a_l_8cpp.html#a5a0b4d30292a539c2681d660fa62df56">rfSerialEvent</a> () <a class="el" href="_sd_fat_8h.html#a30166ffbe6c407702ab1da3ac6f80227">__attribute__</a>((weak))</td></tr>
<tr><td colspan="2"><h2><a name="var-members"></a>
Variables</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">const uint16_t fast_div_lut[17]&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_h_a_l_8cpp.html#a66483eb15545e503793f1279a5794c32">PROGMEM</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_h_a_l_8cpp.html#a310f6f88c47ba219e20702f425715a94">resetFunc</a> )(void)=0</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">volatile uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_h_a_l_8cpp.html#ab0b73a818ecc79490e09cbc2e086b9b9">insideTimer1</a> = 0</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">long&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_h_a_l_8cpp.html#adf5afbea13ec61dc94d6b0ebf6b1eb48">stepperWait</a> = 0</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="structring__buffer.html">ring_buffer</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_h_a_l_8cpp.html#ace077a9982cfc6e7cffcc11101b0df4c">rx_buffer</a> = { { 0 }, 0, 0}</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="structring__buffer__tx.html">ring_buffer_tx</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_h_a_l_8cpp.html#a913c237b12b90ca109743c3ac15725d2">tx_buffer</a> = { { 0 }, 0, 0}</td></tr>
</table>
<hr/><h2>Define Documentation</h2>
<a class="anchor" id="ad85813cb15982722984f0f0db49088f8"></a><!-- doxytag: member="HAL.cpp::serialEvent_implemented" ref="ad85813cb15982722984f0f0db49088f8" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define <a class="el" href="_h_a_l_8cpp.html#ad85813cb15982722984f0f0db49088f8">serialEvent_implemented</a></td>
        </tr>
      </table>
</div>
<div class="memdoc">

</div>
</div>
<hr/><h2>Function Documentation</h2>
<a class="anchor" id="ad39420cdd896dd12c68e36313139d0a5"></a><!-- doxytag: member="HAL.cpp::ISR" ref="ad39420cdd896dd12c68e36313139d0a5" args="(TIMER1_COMPA_vect)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="_h_a_l_8cpp.html#a66f94003221e0886abfe3f0ad6f73879">ISR</a> </td>
          <td>(</td>
          <td class="paramtype">TIMER1_COMPA_vect&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Timer interrupt routine to drive the stepper motors. </p>

</div>
</div>
<a class="anchor" id="a6aae7116e915b82806978c601e42ec42"></a><!-- doxytag: member="HAL.cpp::ISR" ref="a6aae7116e915b82806978c601e42ec42" args="(PWM_TIMER_VECTOR)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="_h_a_l_8cpp.html#a66f94003221e0886abfe3f0ad6f73879">ISR</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="_h_a_l_8h.html#a0ad5f01af339a57de4bd2a3531300d18">PWM_TIMER_VECTOR</a>&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>This timer is called 3906 timer per second. It is used to update pwm values for heater and some other frequent jobs. </p>

</div>
</div>
<a class="anchor" id="a66f94003221e0886abfe3f0ad6f73879"></a><!-- doxytag: member="HAL.cpp::ISR" ref="a66f94003221e0886abfe3f0ad6f73879" args="(EXTRUDER_TIMER_VECTOR)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="_h_a_l_8cpp.html#a66f94003221e0886abfe3f0ad6f73879">ISR</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="_h_a_l_8h.html#a5493104832094f07b22a464e74bd27e5">EXTRUDER_TIMER_VECTOR</a>&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Timer routine for extruder stepper. </p>
<p>Several methods need to move the extruder. To get a optima result, all methods update the printer_state.extruderStepsNeeded with the number of additional steps needed. During this interrupt, one step is executed. This will keep the extruder moving, until the total wanted movement is achieved. This will be done with the maximum allowable speed for the extruder. </p>

</div>
</div>
<a class="anchor" id="a26acc3d99d422c9739b7ab6c968772ca"></a><!-- doxytag: member="HAL.cpp::rf_store_char" ref="a26acc3d99d422c9739b7ab6c968772ca" args="(unsigned char c, ring_buffer *buffer)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="_h_a_l_8cpp.html#a26acc3d99d422c9739b7ab6c968772ca">rf_store_char</a> </td>
          <td>(</td>
          <td class="paramtype">unsigned char&#160;</td>
          <td class="paramname"><em>c</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structring__buffer.html">ring_buffer</a> *&#160;</td>
          <td class="paramname"><em>buffer</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

</div>
</div>
<a class="anchor" id="a5a0b4d30292a539c2681d660fa62df56"></a><!-- doxytag: member="HAL.cpp::rfSerialEvent" ref="a5a0b4d30292a539c2681d660fa62df56" args="() __attribute__((weak))" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="_h_a_l_8cpp.html#a5a0b4d30292a539c2681d660fa62df56">rfSerialEvent</a> </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

</div>
</div>
<a class="anchor" id="a179289a2897d5034b844a3c4de1abc32"></a><!-- doxytag: member="HAL.cpp::setTimer" ref="a179289a2897d5034b844a3c4de1abc32" args="(unsigned long delay)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="_h_a_l_8cpp.html#a179289a2897d5034b844a3c4de1abc32">setTimer</a> </td>
          <td>(</td>
          <td class="paramtype">unsigned long&#160;</td>
          <td class="paramname"><em>delay</em></td><td>)</td>
          <td><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Sets the timer 1 compare value to delay ticks. </p>
<p>This function sets the OCR1A compare counter to get the next interrupt at delay ticks measured from the last interrupt. delay must be &lt;&lt; 2^24 </p>

</div>
</div>
<hr/><h2>Variable Documentation</h2>
<a class="anchor" id="ab0b73a818ecc79490e09cbc2e086b9b9"></a><!-- doxytag: member="HAL.cpp::insideTimer1" ref="ab0b73a818ecc79490e09cbc2e086b9b9" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">volatile uint8_t <a class="el" href="_h_a_l_8cpp.html#ab0b73a818ecc79490e09cbc2e086b9b9">insideTimer1</a> = 0</td>
        </tr>
      </table>
</div>
<div class="memdoc">

</div>
</div>
<a class="anchor" id="a66483eb15545e503793f1279a5794c32"></a><!-- doxytag: member="HAL.cpp::PROGMEM" ref="a66483eb15545e503793f1279a5794c32" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">const uint16_t slow_div_lut [257] <a class="el" href="ui_8h.html#a0ecb7d204e04196a839885837c052002">PROGMEM</a></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<b>Initial value:</b><div class="fragment"><pre class="fragment"> {0,F_CPU/4096,F_CPU/8192,F_CPU/12288,F_CPU/16384,F_CPU/20480,F_CPU/24576,F_CPU/28672,F_CPU/32768,F_CPU/36864
        ,F_CPU/40960,F_CPU/45056,F_CPU/49152,F_CPU/53248,F_CPU/57344,F_CPU/61440,F_CPU/65536
                                          }
</pre></div>
</div>
</div>
<a class="anchor" id="a310f6f88c47ba219e20702f425715a94"></a><!-- doxytag: member="HAL.cpp::resetFunc" ref="a310f6f88c47ba219e20702f425715a94" args=")(void)=0" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void(*  <a class="el" href="_h_a_l_8cpp.html#a310f6f88c47ba219e20702f425715a94">resetFunc</a>)(void)=0</td>
        </tr>
      </table>
</div>
<div class="memdoc">

</div>
</div>
<a class="anchor" id="ace077a9982cfc6e7cffcc11101b0df4c"></a><!-- doxytag: member="HAL.cpp::rx_buffer" ref="ace077a9982cfc6e7cffcc11101b0df4c" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structring__buffer.html">ring_buffer</a> <a class="el" href="_h_a_l_8cpp.html#ace077a9982cfc6e7cffcc11101b0df4c">rx_buffer</a> = { { 0 }, 0, 0}</td>
        </tr>
      </table>
</div>
<div class="memdoc">

</div>
</div>
<a class="anchor" id="adf5afbea13ec61dc94d6b0ebf6b1eb48"></a><!-- doxytag: member="HAL.cpp::stepperWait" ref="adf5afbea13ec61dc94d6b0ebf6b1eb48" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">long <a class="el" href="_h_a_l_8cpp.html#adf5afbea13ec61dc94d6b0ebf6b1eb48">stepperWait</a> = 0</td>
        </tr>
      </table>
</div>
<div class="memdoc">

</div>
</div>
<a class="anchor" id="a913c237b12b90ca109743c3ac15725d2"></a><!-- doxytag: member="HAL.cpp::tx_buffer" ref="a913c237b12b90ca109743c3ac15725d2" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structring__buffer__tx.html">ring_buffer_tx</a> <a class="el" href="_h_a_l_8cpp.html#a913c237b12b90ca109743c3ac15725d2">tx_buffer</a> = { { 0 }, 0, 0}</td>
        </tr>
      </table>
</div>
<div class="memdoc">

</div>
</div>
</div><!-- contents -->
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Defines</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="_h_a_l_8cpp.html">HAL.cpp</a>      </li>

    <li class="footer">Generated on Mon Dec 30 2013 18:53:02 for Repetier-Firmware by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.6.1 </li>
   </ul>
 </div>


</body>
</html>
